package cs.lqs.service.impl;

import cs.lqs.dao.UserMapper;
import cs.lqs.entity.User;
import cs.lqs.service.UserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;


    public User login(String loginName, String password) {
        // 调用根据用户名查询用户信息的方法
        User user = userMapper.findUserByLoginName(loginName);
        if(user!=null){
            // 比较密码是否一致
            if(user.getPwd().equals(password)){
                return user;
            }
        }
        return null;
    }
}
























